import store from '../store';
import { ZAN_JIA, ZAN_JIAN } from "../constants";


//保存与 点赞数状态相关的 action 函数
//5-1 封装函数 
export function jiaAction(data){
    return {
        type: ZAN_JIA,
        data
    }
}

export function jianAction(data){
    return {
        type: ZAN_JIAN,
        data
    }
}

export function asyncJiaAction(data){
    return () => {
        setTimeout(() => {
            store.dispatch(jiaAction(data))
        }, 1000)
    }
}